package lexicon;

import java.util.HashMap;

public class Evaluator {
	
	private HashMap<String, Integer> lexicon;
	
	public Evaluator(String lexiconRoute){
		LexiconLoader  ll= new LexiconLoader(lexiconRoute);
		
		lexicon = ll.load();
	}
	
	public int evaluateTweet(String tweet){
		String[] words = tweet.split(" ");
		int ret = 0;
		
		for (String word: words){
			word = word.trim();
			word = word.toLowerCase();
			if (lexicon.containsKey(word)){
				ret += lexicon.get(word);
			}			
		}
		if (ret>0)
			return 1;
		if (ret < 0)
			return -1;
		return 0;
		
	}

}
